//
// Created by liushuai on 2020/3/20.
//
#include "findCycle.h"
Node* findCycle(Node *head){
    Node* fast=head;
    Node* slow=head;
    while (slow&&fast){
        slow=slow->next;
        if(fast->next)
            fast=fast->next->next;
        else
            return nullptr;
        if(fast==slow)
            return slow;
    }
    return nullptr;

}
